|
|
|
|
|
|
|
Figure 15.13
Breaking a ''bent quadrilateral" into two triangles. |
|
|
|
|
|
|
|
|
For instance, a program that creates a surface of transformation would build triangles between the vertices of adjacent copies of the transformed base curve. Figure 15.14 shows two transformed versions of a base curve and the triangles between them. |
|
|
|
|
|
|
|
|
The program can also create a polygon to represent the untransformed base curve and one to represent the final transformation of the curve. This would seal the ends of the surface to create a solid. If the program uses backface removal, it must ensure that all the triangles as well as the two closing polygons are oriented so that their normals point outward. |
|
|
|
|
|
|
|
|
The following code generates these polygons. The routine assumes that the base curve is closed, so the first and last points are the same. To make the triangles and polygons outwardly oriented, the routine also assumes that the base curve is inwardly oriented with respect to the transformations. In other words, the normal to the base curve should point in the general direction of the transformations. If the base curve lies in the XZ plane and the transformations move the curve in the positive Y direction (upward), the base curve should be oriented counterclockwise. Then its normal also points in the positive Y direction. |
|
|
|
 |
|
|
|
|
' Create the display solid by applying the
' series of transformations in array M(). Public Sub Transform(Optional cap_ends As Variant)
Dim face As Face3d
Dim i As Integer
Dim j As Integer
Dim x0 As Single
Dim y0 As Single |
|
|
|
|
|
|
|
|
Figure 15.14
Creating triangles for a surface of transformation. |
|
|
|
|
|